﻿using System;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace dasBlog.Services.Contracts.XmlStorageSystem
{
    [DataContract(Namespace = "http://radio.xmlstoragesystem.com/")]
    public struct XSSReply
    {
        [DataMember]
        public bool flError;
        [DataMember]
        public string message;
    }

    [DataContract(Namespace = "http://radio.xmlstoragesystem.com/")]
    public struct XSSSaveMultipleFilesReply
    {
        [DataMember]
        public bool flError;
        [DataMember]
        public string message;
        [DataMember]
        public string[] urlList;
    }

    [DataContract(Namespace = "http://radio.xmlstoragesystem.com/")]
    public struct XSSDeleteMultipleFilesReply
    {
        [DataMember]
        public bool flError;
        [DataMember]
        public string message;
        [DataMember]
        public string[] errorList;
    }

    [DataContract(Namespace = "http://radio.xmlstoragesystem.com/")]
    public struct XSSServerCapabilities
    {
        [DataMember]
        public string[] legalFileExtensions;
        [DataMember]
        public int maxFileSize;
        [DataMember]
        public int maxBytesPerUser;
        [DataMember]
        public int ctBytesInUse;
        [DataMember]
        public string yourUpstreamFolderUrl;
    }

    [DataContract(Namespace = "http://radio.xmlstoragesystem.com/")]
    public struct XSSUserInfo
    {
    }

    [ServiceContract(Namespace = "http://radio.xmlstoragesystem.com/")]
    public interface IXmlStorageSystem
    {
        [OperationContract(Action="xmlStorageSystem.deleteMultipleFiles")]
        XSSDeleteMultipleFilesReply DeleteMultipleFiles(string username, string password, string[] relativepathList);
        [OperationContract(Action="xmlStorageSystem.getServerCapabilities")]
        XSSServerCapabilities GetServerCapabilities(string username, string password);
        [OperationContract(Action="xmlStorageSystem.mailPasswordToUser")]
        XSSReply MailPasswordToUser(string username);
        [OperationContract(Action="xmlStorageSystem.ping")]
        XSSReply Ping(string username, string password, int status, int clientPort, XSSUserInfo userinfo);
        [OperationContract(Action="xmlStorageSystem.registerUser")]
        XSSReply RegisterUser(string email, string username, string password, int clientPort, string userAgent, string serialNumber);
        [OperationContract(Action="xmlStorageSystem.requestNotification")]
        XSSReply RequestNotification(string notifyProcedure, int port, string path, string protocol, string[] urlList, XSSUserInfo userinfo);
        [OperationContract(Action="xmlStorageSystem.saveMultipleFiles")]
        XSSSaveMultipleFilesReply SaveMultipleFiles(string username, string password, string[] relativepathList, byte[][] fileTextList);
    }

    public interface XmlStorageSystemChannel : IXmlStorageSystem, IClientChannel { }
}
